<?php

class IndexController extends Zend_Controller_Action
{

	public function init()
	{
        
	}

	public function indexAction()
	{
	   
	}
	
	public function searchAction()
	{ 
	    $this->view->headTitle()->append('Поиск');
        $categoryMapper = new Model_Category_Mapper();
        $men = $categoryMapper->getByGender('муж');
        $women = $categoryMapper->getByGender('жен');
        $child = $categoryMapper->getByGender('дет');  
        $this->view->assign(array('men'=>$men, 'women'=>$women,'child'=>$child));
        if($this->getRequest()->isPost()){
            Zend_Debug::dump($this->getRequest()->getPost());
        }
	}
	
	public function resultAction()
	{
	    $this->view->headTitle()->append('Результаы поиска');
	    $search = new Model_Product_Search($this->getRequest()->getPost());
	     $paginator = $search->getResultByPage((int) $this->_getParam('page',0));
        $paginator->setView($this->view);
        $this->view->assign(array('products'=>$paginator));
	}
}

